<!--#
layout("/layouts/platform.html"){
#-->
<header class="header navbar bg-white shadow">
    <div class="btn-group tool-button">
        <a class="btn btn-primary navbar-btn" href="${base}/platform/member/cart" id="goBack" data-pjax><i class="ti-angle-left"></i>${msg['globals.button.back']}</a>
    </div>
</header>

<div class="content-wrap">
    <div class="wrapper" style="min-height:500px;">
        <section class="panel panel-form">
            <form id="editForm" role="form" class="form-horizontal parsley-form" data-parsley-validate
                  action="${base}/platform/member/cart/editDo" method="post">
                <input name="id" type="hidden" value="${obj.id}">
                <div class="row mb10 mt10">
                    <div class="col-lg-12">
                        <div class="form-group">
                            <label for="accountId" class="col-sm-2 control-label">${msg['member.cart.column.accountId']}</label>
                            <div class="col-sm-8">
                                <input type="text" id="accountId" class="form-control" name="accountId" data-parsley-required="true"
                                       placeholder="${msg['member.cart.column.accountId']}" value="${obj.accountId}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="storeId" class="col-sm-2 control-label">${msg['member.cart.column.storeId']}</label>
                            <div class="col-sm-8">
                                <input type="text" id="storeId" class="form-control" name="storeId" data-parsley-required="true"
                                       placeholder="${msg['member.cart.column.storeId']}" value="${obj.storeId}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="goodsId" class="col-sm-2 control-label">${msg['member.cart.column.goodsId']}</label>
                            <div class="col-sm-8">
                                <input type="text" id="goodsId" class="form-control" name="goodsId" data-parsley-required="true"
                                       placeholder="${msg['member.cart.column.goodsId']}" value="${obj.goodsId}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="productId" class="col-sm-2 control-label">${msg['member.cart.column.productId']}</label>
                            <div class="col-sm-8">
                                <input type="text" id="productId" class="form-control" name="productId" data-parsley-required="true"
                                       placeholder="${msg['member.cart.column.productId']}" value="${obj.productId}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="sku" class="col-sm-2 control-label">${msg['member.cart.column.sku']}</label>
                            <div class="col-sm-8">
                                <input type="text" id="sku" class="form-control" name="sku" data-parsley-required="true"
                                       placeholder="${msg['member.cart.column.sku']}" value="${obj.sku}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="num" class="col-sm-2 control-label">${msg['member.cart.column.num']}</label>
                            <div class="col-sm-8">
                                <input type="text" id="num" class="form-control" name="num" data-parsley-required="true"
                                       placeholder="${msg['member.cart.column.num']}" value="${obj.num}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="price" class="col-sm-2 control-label">${msg['member.cart.column.price']}</label>
                            <div class="col-sm-8">
                                <input type="text" id="price" class="form-control" name="price" data-parsley-required="true"
                                       placeholder="${msg['member.cart.column.price']}" value="${obj.price}" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="imgurl" class="col-sm-2 control-label">${msg['member.level.column.imgurl']}</label>
                            <div class="col-sm-8">
                                <div id="queue"></div>
                                <div class="input-group">
                              <span class="input-group-btn">
                              <input id="file_upload" name="file_upload" type="file" multiple="false">
                              </span>
                                </div>
                                <div id="img" style="padding: 5px;">
                                    <!--#if(!isEmpty(obj.imgurl)){#-->
                                    <img src='${obj.imgurl!}' style='width:150px;'>
                                    <i class="fa fa-close" onclick="$('#picurl').val('');$('#img').html('');"></i>
                                    <!--#}#-->
                                </div>
                                <input type="hidden" id="imgurl" name="imgurl" value="${obj.imgurl!}" >
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3"></div>
                <div class="col-lg-6">
                    <div class="form-group text-center">
                        <label></label>

                        <div>
                            <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="${msg['globals.button.submit.tip']}">${msg['globals.button.submit']}</button>
                        </div>
                    </div>
                </div>
            </form>
        </section>

    </div>
</div>
<script language="JavaScript">
    $(document).ready(function () {
        $('#file_upload').uploadifive({
            'auto': true,
            'multi': false,
            'width': '100%',
            'height': '35',
            'buttonText': '请选择图片',
            'fileType': 'image/jpg,image/jpeg,image/png',
            'fileSizeLimit': 1024,
            'queueSizeLimit': 1,
            'formData': {},
            'queueID': 'queue',
            'uploadScript': '${base}/open/file/upload/image',
            'onUploadComplete': function (file, data) {
                data = JSON.parse(data);
                if (data.code == 0) {
                    Toast.success(data.msg);
                    $("#img").html("<img src='" + data.data + "' style='width:150px;'>");
                    $("#imgurl").val(data.data);
                } else {
                    clearFile();
                    Toast.error(data.msg);
                }
            },
            'onDrop': function (file, fileDropCount) {
                clearFile();
            },
            'onClearQueue': function (queue) {
                clearFile();
            },
            'onCancel': function () {
                clearFile();
            }
        });
        $('#editForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
                form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, form) {
                if (data.code == 0) {
                    Toast.success(data.msg);
                    setTimeout(function () {
                        $("#goBack").trigger("click");
                    }, 1000);
                } else {
                    Toast.error(data.msg);
                }
                form.find("button:submit").button("reset");
            }
        });
    });
</script>
<!--#}#-->